/*******************************************************************************
 * Copyright (c) 2008 Smart Mai(smardio@gmail.com).
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the GNU Public License v2.0
 * which accompanies this distribution, and is available at
 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
 * 
 * Contributors:
 *     Smart Mai(smardio@gmail.com) - initial API and implementation
 ******************************************************************************/
package com.smartdio.company.views;

import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Tree;

import com.smartdio.company.model.CompanyDataProvider;

/**
 * @author smart
 *
 */
public class CompanyList extends Composite {

	private Tree tree = null;
	private TreeViewer treeViewer = null;

	/**
	 * @param parent
	 * @param style
	 */
	public CompanyList(Composite parent, int style) {
		super(parent, style);
		initialize();
		initViewer();
	}

	private void initialize() {
		tree = new Tree(this, SWT.BORDER|SWT.MULTI);
		treeViewer = new TreeViewer(getTree());
		setSize(new Point(300, 200));
		setLayout(new FillLayout());
	}

	


	public Tree getTree() {
		return tree;
	}

	private void initViewer(){
		treeViewer.setContentProvider(new CompanyDataProvider());
		treeViewer.setLabelProvider(new CompanyLabelProvider());
	}

	public TreeViewer getTreeViewer() {
		return treeViewer;
	}

	
}
